import {LogLanguage} from "../dist/index.js"

// 测试用例
const testCases = [
  "290 INFO  [TID:] [fcdfba1a21214a8e97c7d8fd1a8aa287.1161.17544505317727189] service.SBYBaseService (com.cn.yft.ora.bank.sby.service.SBYBaseService:70) - 【身边云接口】请求结束",
  "2024-10-21T00:05:21.303+0800	FATAL	router/router.go:12	/api/electronSystem/initElectronSystemInfo",
  "[2024-10-28 06:16:23.123] [INFO] [main] [com.example.MyClass.myMethod] - System starting up..."
]

console.log("Testing LogLanguage parser...")

testCases.forEach((testCase, index) => {
  console.log(`\nTest case ${index + 1}:`)
  console.log(`Input: ${testCase}`)
  
  try {
    const tree = LogLanguage.parser.parse(testCase)
    console.log("Parse successful!")
    
    // 检查是否识别到类路径
    let hasClassPath = false
    tree.iterate({
      enter: (node) => {
        if (node.name === "CLASSPATHExpression") {
          hasClassPath = true
          console.log(`Found CLASSPATHExpression: "${testCase.slice(node.from, node.to)}"`)
        }
      }
    })
    
    if (hasClassPath) {
      console.log("✅ Class path highlighting should work!")
    } else {
      console.log("❌ No class path found")
    }
    
  } catch (error) {
    console.log(`Parse failed: ${error.message}`)
  }
}) 